package com.bestcem.xm.qdes.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bestcem.xm.component.mybatis.base.BaseEntity;
import com.bestcem.xm.component.mybatis.format.String2JacksonSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "ds_qdes_projectentry")
public class QdesProjectEntry extends BaseEntity {

    @TableId(value = "id")
    private String id;

    /**
     * 公司id
     */
    @JsonProperty("org_id")
    @TableField(value = "org_id")
    private String orgId;

    /**
     * 问卷id
     */
    @JsonProperty("project_id")
    @TableField(value = "project_id")
    private String projectId;

    /**
     * 用户id
     */
    @JsonProperty("user_id")
    @TableField(value = "user_id")
    private String userId;

    /**
     * 项目名称
     */
    @TableField(value = "title")
    private String title;

    /**
     * 入口类型
     */
    @TableField(value = "category")
    private Integer category;

    /**
     * 项目权限列表
     */
    @JsonProperty(value = "permissions")
    @TableField(value = "permissions_arry")
    @JsonSerialize(using = String2JacksonSerializer.class)
    private String permissionsArry;

    //适配MapStruct弄了个冗余字段
    @TableField(exist = false)
    @JsonIgnore
    private List<String> permissionsList;

    /**
     * 权限类型
     */
    @JsonProperty("perm_type")
    @TableField(value = "perm_type")
    private Integer permType;

    /**
     * 所属文件夹id
     */
    @JsonProperty("folder_id")
    @TableField(value = "folder_id")
    private String folderId;

    /**
     * 项目状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 项目是否已读状态
     */
    @JsonProperty("badge_status")
    @TableField(value = "badge_status")
    private Integer badgeStatus;

    /**
     * 创建人
     */
    @JsonProperty("creator_id")
    @TableField(value = "creator_id")
    private String creatorId;

    /**
     * 置顶顺序
     */
    @JsonProperty("top_order")
    @TableField(value = "top_order")
    private Integer topOrder;
}